<?php if (!defined('THINK_PATH')) exit();?> <!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>公告列表</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico"> <link href="/game/Public/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/game/Public/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/game/Public/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/game/Public/admin/css/animate.css" rel="stylesheet">
    <link href="/game/Public/admin/css/style.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>公告列表</h5>
                        <div class="ibox-tools">                           
                        </div>
                    </div>
                    <div class="ibox-content">

                        <table class="table table-bordered table-hover">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>公告标题</th>
                                    <th>公告内容</th>
                                    <th>公告类型</th>
                                    <th>添加时间</th>
                                    <th>状态</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                            <?php if(empty($adminList)): ?><tr>
                                <td colspan="12">没有相关数据！</td>
                            </tr><?php endif; ?>
                            <?php if(is_array($adminList)): foreach($adminList as $key=>$v): ?><tr>
                                    <td><?php echo ($v["id"]); ?></td>
                                    <td><?php echo ($v["title"]); ?></td>
                                    <td><?php echo ($v["content"]); ?></td>
                                    <td>
                                    <?php switch($v["type"]): case "1": ?>首页公告<?php break;?>
                                    <?php case "2": ?>滚动字幕<?php break;?>
                                    <?php case "3": ?>喇叭公告<?php break;?>
                                    <?php case "4": ?>提示公告<?php break; endswitch;?></td>
                                    <td><?php echo ($v["addtime"]); ?></td>
                                    <td><?php echo ($v["status"]); ?></td>
                                    <td><a href="<?php echo U('Admin/Bulletin/bulletinAdd');?>?id=<?php echo ($v["id"]); ?>">编辑</a>&nbsp;|&nbsp;<a href="#" onclick="del(<?php echo ($v["id"]); ?>)">删除</a></td>
                                </tr><?php endforeach; endif; ?> 
                            </tbody>
                                
                        </table>
                        <?php echo ($page); ?>
                    </div>
                </div>
            </div>

        </div>
    </div>

    <!-- 全局js -->
    <script src="/game/Public/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="/game/Public/admin/js/bootstrap.min.js?v=3.3.6"></script>



    <!-- Peity -->
    <script src="/game/Public/admin/js/plugins/peity/jquery.peity.min.js"></script>

    <!-- 自定义js -->
    <script src="/game/Public/admin/js/content.js?v=1.0.0"></script>


    <!-- iCheck -->
    <script src="/game/Public/admin/js/plugins/iCheck/icheck.min.js"></script>

    <!-- Peity -->
    <!-- <script src="/game/Public/admin/js/demo/peity-demo.js"></script> -->

    <script>
        $(document).ready(function () {
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green',
                radioClass: 'iradio_square-green',
            });
        });

    function del(id){
     if(confirm("确定要删除该公告吗？")){
     $.ajax({
             type:'post',
             url:"<?php echo U('Admin/Bulletin/del');?>?id="+id,
             dataType:'json',
             success:function(data){ 
                if (data=='success') {
                    alert('删除成功！');
                    window.location.href="<?php echo U('Admin/Bulletin/bulletinList');?>";
                }else{
                    alert('删除失败！');                                          
                }                          
             }
         })
     }
    
}
    </script>

    
    

</body>

</html>